
function login() {
    //拿到前台的数据
    let data = {
        phone : $("#phone").val(),
        password:$("#password").val(),
        code: $("#code").val()
    };
    $.ajax({
        url:"/login",
        data:data,
        type:"post",
        dataType:"json",
        success:function (data) {
            console.log(data);
            if(data.result == "success"){
                // alert("登录成功！(=^ ^=)");
                sessionStorage.setItem("isLogin","true");
                sessionStorage.setItem("userName",data.model.userName);
                sessionStorage.setItem("loginPhone",$("#phone").val());
                window.open("/html/admin/manage.html","_self");
            }else if(data.result == "codeError"){
                alert("验证码错误！")
                // window.history.back();
            }else{
                alert("手机或密码错误，请重新输入！")
            }
        }
    })
}